﻿using Castle.ActiveRecord;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Online_Course.Domain
{
    [ActiveRecord]
    public class SysUser:BaseEntity<SysUser>
    {
        [Property(Length = 30, NotNull = false)]
        [Display(Name = "用户名")]
        public string Name { get; set; }

        [Property(Length = 30, NotNull = false)]
        [Display(Name = "账号")]
        public string Account { get; set; }

        [Property(Length = 30, NotNull = false)]
        [Display(Name = "联系电话")]
        public string Phone { get; set; }

        [Property(Length = 30, NotNull = false)]
        [Display(Name = "密码")]
        public string Password { get; set; }

        [Property]
        [Display(Name = "状态")]
        public int IsActive { get; set; }

        /// <summary>
        /// 所属角色
        /// </summary>
        [HasAndBelongsToMany(typeof(SysRole), Table = "SysUser_SysRole", ColumnKey = "SysUserId", ColumnRef = "SysRoleId", Cascade = ManyRelationCascadeEnum.None, Lazy = false)]
        [Display(Name = "所属角色")]
        public IList<SysRole> SysRoleList { get; set; } 

    }
}
